using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Mail;
using BookBarter;

/// <summary>
/// This child class is used to notify a user of a trade via email
/// </summary>
public class EmailNotifier : Notifier
{
    public EmailNotifier()
	{
    }

    /// <summary>
    /// notify via email
    /// </summary>
    /// <param name="linkNode"></param>
    /// <param name="isCancelled"></param>
    public void Notify(TradeLink tradeLink, AcceptedStatus accepted)
    {
        this.ConstructMessage(tradeLink, accepted);

        Results.ResultString += "<br><br> Sent email to User " + GetPerson.UserId + " <br>name: " + GetPerson.FirstName + " " + GetPerson.LastName;

        MailMessage mail = new MailMessage();
        mail.To = GetPerson.EmailAddress;
        mail.From = "booktrader@psu.edu";
        mail.Subject = GetTitle;
        mail.Body = GetMessage;
        SmtpMail.SmtpServer = "smtp.psu.edu";

        SmtpMail.Send(mail);

    }

}
